package com.nku.mason.scm.controller;

import java.util.Map;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.nku.mason.scm.service.SysParamService;
import com.nku.mason.scm.vo.SysParam;

@Controller
@RequestMapping("/sysParam")
public class SysParamAction extends BaseController {
	@Resource
	private SysParamService sysParamService;

	@RequestMapping("/reloadSysParam")
	public String reloadSysParam() {
		loadSysParam();
		return "";
	}

	@PostConstruct
	public String initSysParam() {
		loadSysParam();
		return "";
	}

	private void loadSysParam() {
		System.out.println("-----------系统参数初始化开始！----------");
		SysParam sysParam = new SysParam();
		Map<String, Map<String, Object>> sysParamMap = sysParamService.loadSysParam(sysParam);
		this.application.setAttribute("sysParam", sysParamMap);
		System.out.println("-----------系统参数初始化完毕！----------");
	}

}
